package com.lmx.messagetemplate.ui.adapter;

import android.content.Context;
import android.view.View;

import androidx.recyclerview.widget.RecyclerView;

import com.lmx.messagetemplate.bean.MessageTemplate;

import java.util.List;

public abstract class BaseAdapterRv<T> extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    public Context context;
    public List<T> data;

    public BaseAdapterRv(Context context) {
        this.context = context;
    }

    public void setData(List<T> data) {
        this.data = data;
        notifyDataSetChanged();
    }

    public T getItem(int position) {
        return data.get(position);
    }

    @Override
    public int getItemCount() {
        return data != null ? data.size() : 0;
    }

}
